package com.wholesale.beans;

import org.json.JSONException;
import org.json.JSONObject;

public class CorrectGoodsPrice {
	private int goodsId;
	private double price;
	private JSONObject jsonObject;

	/**
	 * @return the goodsId
	 */
	public int getGoodsId() {
		return goodsId;
	}

	/**
	 * @param goodsId
	 *            the goodsId to set
	 */
	public void setGoodsId(int goodsId) {
		this.goodsId = goodsId;
	}

	/**
	 * @return the price
	 */
	public double getPrice() {
		return price;
	}

	/**
	 * @param price
	 *            the price to set
	 */
	public void setPrice(double price) {
		this.price = price;
	}

	public void jsonAnalytic(String jsonString) {

		try {
			jsonObject = new JSONObject(jsonString);
			jsonAnalytic(jsonObject);
		} catch (JSONException e) {
		}
	}

	public void jsonAnalytic(JSONObject jsonObject) {
		this.jsonObject = jsonObject;

		try {
			goodsId = jsonObject.getInt("goodsId");
		} catch (JSONException e) {

		}

		try {
			price = jsonObject.getDouble("price");
		} catch (JSONException e) {

		}

	}
}
